package beans.impl;

import java.io.Serializable;

/**
 * Référence produit
 * @author M2 MIAGE Apprentissage - Groupe 3 (JPastor)
 */
public class ProductPK implements Serializable {

    public int storeId;
    public int productId;

    public ProductPK() {}

    public ProductPK(int refProduct, int refProductStore) {
        this.storeId = refProductStore;
        this.productId = refProduct;
    }

    /**
     * @return the storeId
     */
    public int getStoreId() {
        return storeId;
    }

    /**
     * @param storeId the storeId to set
     */
    public void setStoreId(int storeId) {
        this.storeId = storeId;
    }

    /**
     * @return the productId
     */
    public int getProductId() {
        return productId;
    }

    /**
     * @param productId the productId to set
     */
    public void setProductId(int productId) {
        this.productId = productId;
    }

    @Override
    public int hashCode() {
        return ( ( (int) storeId ) ^ ( (int) productId) );
    }

    public boolean equals(Object otherOb) {
        if (this == otherOb) {
            return true;
        }
        if (!(otherOb instanceof ProductPK)) {
            return false;
        }

        ProductPK other = (ProductPK) otherOb;
        return (other.productId == this.productId) && (other.storeId == this.storeId);
    }
}
